package com.itheima.ydd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.itheima.ydd.entity.Cate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Copyright (C), 2021-2022
 * Author: 16372
 * Date: 2022/2/24 21:00
 * FileName: CateMapper
 * Description: 分类表接口
 */
@Mapper
public interface CateMapper extends MPJBaseMapper<Cate> {
    @Select("SELECT ydd_cate.id,ydd_cate.catename,COUNT(*) AS num from ydd_article,ydd_cate where ydd_article.cateid=ydd_cate.id GROUP BY ydd_article.cateid")
    List<Cate> getList();
}
